package life;

public class Test {
    public static void main(String[] args) {
        AlarmDoor alarmDoor = new AlarmDoor();
        System.out.println(alarmDoor.name);
        alarmDoor.lock();
        alarmDoor.alarm();
        alarmDoor.openLock();
        alarmDoor.openDoor();
        System.out.println("跑。。。。。。。");
        alarmDoor.closeDoor();
        System.out.println("=========箱子==========");
        Box box = new AlarmDoor();
        System.out.println(Box.NAME);
        box.lock();
        box.openLock();
        ((AlarmDoor)box).openDoor();
        ((AlarmDoor)box).closeDoor();
    }
}

interface Lock {
    void lock();
}

interface OpenLock {
    void openLock();
}

interface Alarm {
    void alarm();
}

interface Box extends Lock, OpenLock {
    String NAME = "箱子";

}

abstract class Door implements Box {
    String name = "门";

    public abstract void openDoor();

    public abstract void closeDoor();

}

class AlarmDoor extends Door implements Alarm {
    String name = "报警门";

    @Override
    public void lock() {
        System.out.println("上锁");
    }

    @Override
    public void openLock() {
        System.out.println("开锁");
    }

    @Override
    public void alarm() {

        System.out.println("报警");
    }

    @Override
    public void openDoor() {

        System.out.println("开门");
    }

    @Override
    public void closeDoor() {

        System.out.println("关门");
    }
}
